package likou.jindian;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2020/12/27 07:19
 */
public class _05_06 {
    public static void main(String[] args) {
        System.out.println(convertInteger(826966453,
                -729934991));
    }

    public static int convertInteger(int A, int B) {
        System.out.println("  " + Integer.toBinaryString(A));
        System.out.println(Integer.toBinaryString(B));
        int daan = 0;
        String As = Integer.toBinaryString(A);
        String Bs = Integer.toBinaryString(B);
        int BsI = Bs.length() - 1;
        int AsI = As.length() - 1;
        while (BsI >= 0 && AsI >= 0) {
            if (Bs.charAt(BsI) != As.charAt(AsI)) {
                daan++;
            }
            BsI--;
            AsI--;
        }
        System.out.println(daan);
        while (AsI >= 0) {
            daan += As.charAt(AsI) == '1' ? 1 : 0;
            AsI--;
        }
        while (BsI >= 0) {
            daan += Bs.charAt(BsI) == '1' ? 1 : 0;
            BsI--;
        }
        return daan;
    }
}
